package com.hx.vending.dao;

import com.hx.vending.bean.Dict;
import com.hx.vending.bean.Equipment;
import com.hx.vending.bean.Model;
import com.hx.vending.bean.entity.EquipmentDentity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/11/26.
 */
@Repository
public interface EquipmentMapper {

    List<Equipment> selectByFieldId(Integer fieldId);

    List<Equipment> selectByExample(Equipment equipment);

    Model selectModelById(Integer eqModelId);

    Equipment selectByPrimary(Equipment equipment);

    Integer updateByPrimaryKeySelective(Equipment equipment);

    Integer insertSelective(Equipment equipment);

    Integer updateByEqipment(Equipment equipment);

    List<Dict> selectDictByPid(Integer pid);

    List<Map<String,Object>> getEquipmentNumberByFieldId(@Param("fieldList") List<Integer> fieldList,@Param("userId")Integer userId);

    List<Map<String, Object>> selectEquipmentByFieldId(@Param("fieldId") Integer fieldId);

    int deleteEquipmentById(String equipmentId);

    List<EquipmentDentity> selectByExamplePage(@Param("equipmentId") String equipmentId, @Param("equipmentType") String equipmentType,
                                               @Param("userName") String userName, @Param("equipmentUseCondition") Integer equipmentUseCondition,
                                               @Param("equipmentState") Integer equipmentState, @Param("pageNum") Integer pageNum);
    Integer selectEquipmentNum(@Param("equipmentId") String equipmentId,@Param("equipmentType") String equipmentType,
                               @Param("userName") String userName,@Param("equipmentUseCondition") Integer equipmentUseCondition,
                               @Param("equipmentState") Integer equipmentState);

    int updateEquipmentVideo(Equipment equipment);

    int updateEquipmentByUserId(Integer userId);

    int updatePictureNull(Equipment equipment);

    List<Equipment> selectByFieldIds(@Param("integers") Integer[] integers);

    /**
     * 物联卡清空
     * @param equipment
     * @return
     */
    int updateFlowcardNull(Equipment equipment);

    /**
     * 查询拥有物联卡的设备
     * @return
     */
    List<Equipment> selectFlowcardNotNull();

    Equipment selectById(@Param("equipmentId") String equipmentId);

    /**
     * 查询离线超过时间的在线设备
     * @param time
     * @return
     */
    int updateEquipmentByTimeDifference(@Param("time") String time);
}
